using System;

namespace IQIGame.Onigao.GamePlay
{
    [SerializableGroup(SerializableGroup.LevelModuleConfig)]
    public partial class ObstacleInfo
    {
        public bool isStatic;
        public int x;
        public int y;
        public int w;
        public int h;
        public int height;
        /// <summary>
        /// 是否是纯客户端阻挡
        /// 由于主城会有客户端导航，所以这个字段现在的意义变成了是否是物理阻挡（不走RecastNavigation）
        /// </summary>
        public bool isClient;

        public bool isCapsule => h == 0;
        public int radius => w;
        public int rectW => w;
        public int rectH => h;
        public bool invalid => w == 0 || height == 0;
        public int maxDisToCenter => isCapsule ? w : Math.Max(w, h) / 2;

        public override string ToString()
        {
            return $"isStatic={isStatic}, x={x}, y={y}, {(isCapsule ? "radius=" + radius : $"rectW:{rectW}, rectH:{rectH}")}";
        }
    }
}
